<template>
  <div id="MyAgentS">
    <div class="SQList">
      <van-tabs v-model="active" @click="handleclickto" swipeable>
        <van-tab title="我的待办">
          <ul v-if="listData.length > 0">
            <li
              v-for="(item, index) in listData"
              :key="index"
              @click="listClick(item)"
            >
              <p style="font-weight: bold; height: 30px">
                <span style="float: left">{{ item.NODE_NAME }}</span>
                <span v-if="item.SQR" style="float: right">
                  {{item.SQR }}
                </span>
                <span v-else-if="item.F_HOUSEAPPLICANT" style="float: right">
                  {{item.F_HOUSEAPPLICANT}}
                </span>
                <span v-else-if="item.F_CQR" style="float: right">
                  {{item.F_CQR}}
                </span>
              </p>
              <p style="font-size: 14px; color: #848484; height: 30px">
                <span style="float: left">进度：{{ item.PROC_NAME }}</span>
                <span style="float: right" v-if="item.SQSJ"
                  >申请时间：{{ item.SQSJ }}</span
                >
                <span style="float: right" v-if="item.F_TROUBLESHOOTINGTIME"
                  >排查时间：{{
                    item.F_TROUBLESHOOTINGTIME.split(" ")[0]
                  }}</span
                >
              </p>
              <p style="font-size: 14px; color: #848484; height: 30px">
                <span v-if="item.FWDZ" style="float: left"
                  >地址：{{
                    item.FWDZ
                  }}</span>
                <span v-else-if="item.F_PERMANENTADDR"  style="float: left"
                >地址：{{item.F_PERMANENTADDR}}</span>
                <span v-else-if="item.F_ADDRESS"  style="float: left"
                >地址：{{item.F_ADDRESS}}</span>
                <span  style="float: right" v-else>暂无数据</span>
              </p>
            </li>
          </ul>
          <ul v-else>
            <div style="height: 60vh; text-align: center; padding-top: 20vh">
              <div style="margin-bottom: 10px">
                <img
                  src="https://nfzjszlb.jst.zj.gov.cn/serverfile/zheliban/icon/DSF/50.png"
                />
              </div>
              <div>暂无数据</div>
            </div>
          </ul>
        </van-tab>
        <van-tab title="申请记录">
          <myShenQing1></myShenQing1>
        </van-tab>
      </van-tabs>
      <!-- <ul @click="handleGoto">
        <span
          style="
            width: 70px;
            height: 30px;
            line-height: 30px;
            background: #007aff;
            border-radius: 6px;
            margin: 4px 0;
            text-align: center;
            display: inline-block;
            color: #fff;
          "
          >申请记录</span
        >
      </ul> -->
    </div>
  </div>
</template>

<script>
import { FileServerProxy } from "@/utils/api";
import myShenQing1 from "./myShenQing1.vue";
export default {
  name: "MyAgentS",
  data() {
    return {
      listData: [
        // {
        //   HOUSEAPPLICANT: '某某某',
        //   NODE_NAME: '危改整治',
        //   PROC_NAME: '危房鉴定',
        //   APPLYTIME: '2022-03-24',
        //   PERMANENTADDR: '地址'
        // }
      ],
      active:'0'
    };
  },
  components:{
      myShenQing1
  },
  methods: {
    handleclickto(){

    },
    getListData: async function () {
      let params = {
        accessCode: "688bd3883572440a859dfd8ba9194e7b",
        cityCode: window.localStorage.getItem("citycode")
          ? window.localStorage.getItem("citycode")
          : "441300000000",
        params: {
          dataguid: "bcc27d4d-8597-4156-b914-22cf594780d2",
          searchObject: JSON.stringify([]),
          token: window.localStorage.getItem("token"),
        },
      };
      const res = await FileServerProxy(params);
      this.listData = JSON.parse(res.data.data).Data;
      let params1 = {
        accessCode: "688bd3883572440a859dfd8ba9194e7b",
        cityCode: window.localStorage.getItem("citycode")
          ? window.localStorage.getItem("citycode")
          : "441300000000",
        params: {
          dataguid: "20966a43-764f-43ac-9c7c-ca0d440e5605",
          searchObject: JSON.stringify([]),
          token: window.localStorage.getItem("token"),
        },
      };
      const res1 = await FileServerProxy(params1);
      this.listData = this.listData.concat(JSON.parse(res1.data.data).Data);
      let params2 = {
        accessCode: "688bd3883572440a859dfd8ba9194e7b",
        cityCode: window.localStorage.getItem("citycode")
          ? window.localStorage.getItem("citycode")
          : "441300000000",
        params: {
          dataguid: "cf5a8d5f-e867-4ee3-b465-a522f6c87d4e",
          searchObject: JSON.stringify([]),
          token: window.localStorage.getItem("token"),
        },
      };
      const res2 = await FileServerProxy(params2);
      console.log(JSON.parse(res2.data.data).Data);
      this.listData = this.listData.concat(JSON.parse(res2.data.data).Data);
      console.log(this.listData)
    },
    handleGoto() {
      this.$router.push({
        path: "/myshenQing1",
        query: {
          data: "1",
        },
      });
    },
    listClick(item) {
      console.log(item)
      // 镇街督办
      if (item.WF_GUID === '{AFA7FC7F-BDBD-46EA-ABD2-EEF0766096D2}'){
         switch (item.NODE_GUID) {
           // 鉴定公司
           case '{3F794E03-9253-439B-8332-79BCBDE26294}':
                 this.$router.push({
                   path: "/DangerousAppraisal",
                   query: { data: JSON.stringify(item) },
                 });
             break
           // 复核鉴定
           case '{B4FCC404-5D84-4F9A-B5A2-243ECE2FB244}':
                 this.$router.push({
                   path: "/DangerousAppraisal",
                   query: { data: JSON.stringify(item) },
                 });
             break
         }
      }else{
        switch (item.NODE_GUID) {
          // （农户）危改申请
          case "{5E869057-F0CA-4E87-80D4-9B7FECEAFE9E}":
            break;
          // 鉴定公司鉴定
          case "{C856358A-5B9A-42F0-814D-5BF3F63F5929}":
            this.$router.push({
              path: "/DangerousAppraisal",
              query: { data: JSON.stringify(item) },
            });
            break;
          case "{4A140424-C781-402F-A821-502828EB75DA}":
            this.$router.push({
              path: "/DangerousAppraisal",
              query: { data: JSON.stringify(item) },
            });
            break;
          //  农户申请
          case "{7A629180-CF1F-4600-AB4C-33E33ED1E743}":
            this.$router.push({
              path: "/FarmersRenovation1",
              query: {
                data: JSON.stringify(item),
              },
            });
            break;
          // 农户危房整治
          case "{0C256BFE-BC5F-4D63-8AEC-4630EC19F78B}":
            if (item.JWFS == "265") {
              this.$router.push({
                path: "/FarmersRenovation",
                query: { data: JSON.stringify(item) },
              });
            } else {
              this.$router.push({
                path: "/FarmersRenovation",
                query: { data: JSON.stringify(item) },
              });
            }
            break;
          //  申请复核鉴定
          case "{27EE0E9F-607B-4D25-8934-3693F950C095}":
            this.$router.push({
              path: "/DangerousAppraisal",
              query: { data: JSON.stringify(item) },
            });
            break;
          case "{7A93D2DC-D4B9-4E6A-8DC6-4C2FDFBB9D45}":
            this.$router.push({
              path: "/DangerousAppraisal",
              query: { data: JSON.stringify(item) },
            });
            break;
          //    申请建房补助
          case "{B3882940-DD70-48B9-BCDC-544280832103}":
            this.$router.push({
              path: "/SubsidyApplication",
              query: { data: JSON.stringify(item) },
            });
            break;
          //  房屋安全鉴定
          case "{53BC28FE-1869-4C12-9683-92B5B059D1BB}":
            this.$router.push({
              path: "/SafetyAppraisal",
              query: { data: JSON.stringify(item) },
            });
            break;
          //  农户危房改造
          case "{6048BDEF-057A-4080-A536-D9EEE89626D7}":
            this.$router.push({
              path: "/FarmersRenovation",
              query: {
                data: JSON.stringify(item),
                type: "NHWFGZ",
              },
            });
            break;
        }
      }

    },
  },
  mounted() {
    this.getListData();
    // if (ZWJSBridge) {
    //   ZWJSBridge.setTitle({
    //     title: "我的危改",
    //   })
    //     .then((res) => {
    //     })
    //     .catch((err) => {
    //     });
    // }
  },
};
</script>

<style scoped lang="scss">
#MyAgentS {
  height: 100vh;
  overflow: auto;
  padding: 10px;
  font-family: "Helvetica Neue", Helvetica, STHeiTi, sans-serif;
  ul li {
    padding-top: 10px;
    border-bottom: 1px solid #d2d2d2;
  }
}
</style>
